package erfgame.core.world.terrain.file;

import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

public class BaseSerializingObjectDAO<T extends Serializable> implements Serializer<T> {

	public BaseSerializingObjectDAO() {
	}
	
	public T retrieveObject(InputStream ins, T into ) 
		throws Exception {
		ObjectInputStream oins = new ObjectInputStream( ins );
		return (T)oins.readObject();
	}


	public void storeObject( OutputStream outs, T object ) throws Exception {
		ObjectOutputStream oouts = new ObjectOutputStream( outs );
		oouts.writeObject( object );
	}
}
